<?php
class M_PhotoModel extends Apps_Db_Table_Abstract {

    public function listPhotoByReference($referenceId, $referenceType) {
        $q = $this->_db
                    ->select()
                    ->from('photo', null)
                    ->where('reference_id =?', $referenceId)
                    ->where('reference_type =?', $referenceType)
                    ->where('status =?', 1)
                    ->columns(array('id'   => 'photo.id',
                                    'path' => 'photo.path'));

        return $q;
    }
}